﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace SOEI.Solution.Helper
{
    public class ParamItem
    {
        public ParamItem() { }

        public ParamItem(string pName, ParameterDirection pDirection)
        {
            Name = pName;
            Direction = pDirection;
        }

        public string Name { get; set; }

        public object Value { get; set; }

        private int _size = 4000;

        public int Size 
        {
            get
            {
                if(Value != null)
                {
                    if(Value is byte[])
                    {
                        _size = (Value as byte[]).Length;
                    }
                    else if(Value is string)
                    {
                        _size = Encoding.Default.GetBytes(Value as string).Length;
                    }
                }

                return _size;
            }
            set
            {
                _size = value;
            }
        }

        public ParameterDirection Direction { get; set; } = ParameterDirection.Input;
    }
}
